package edu.aynu.util;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.mail.SimpleMailMessage;

import java.util.Random;

/**
 *   邮箱发送验证码
 *   生成六个数字的验证码
 */
public class CodeUtil {

    /**
     * 获取六位数字的验证码
     * @return
     */
    public static String getCode() {
        String code = "";
        Random random = new Random();
        StringBuilder result = new StringBuilder();
        for (int i = 0; i < 6; i++) {
            result.append(random.nextInt(10));
        }
        code = result.toString();
        return code;
    }
}
